/**
 * 设置 token
 * @param token
 * @returns
 */
export const setToken = (token: string) => sessionStorage.setItem('token', token);

/**
 * 获取 token
 * @returns
 */
export const getToken = () => sessionStorage.getItem('token');

/**
 * 移除指定 token
 * @returns
 */
export const removeToken = () => sessionStorage.removeItem('token');

/**
 * 清除所有 token
 * @returns
 */
export const clearToken = () => sessionStorage.clear();

export const dalImg = (url: string) => {
  if (url) {
    if (url.startsWith('http')) return url;
    return `${serverUrl}${url}`;
  }
  return 'https://img0.baidu.com/it/u=479986306,1031075498&fm=253&fmt=auto&app=138&f=JPEG?w=400&h=624';
};

export const uploadActionUrl = serverUrl + '/common/upload';
